package com.abyss.sink;

import com.abyss.util.HbaseUtil;
import org.apache.flink.streaming.api.functions.sink.RichSinkFunction;
import org.apache.hadoop.hbase.client.Put;

import java.util.List;

/**
 * @Date 2020/9/16
 */
public class HbaseSink extends RichSinkFunction<List<Put>> {

    //开发步骤：
    //1.创建构造方法
    private String tableName;
    public HbaseSink( String tableName){
        this.tableName = tableName;
    }

    //2.执行写入操作


    @Override
    public void invoke(List<Put> value, Context context) throws Exception {

        //执行数据写入
        HbaseUtil.putList(tableName,value);
    }
}
